using System;
namespace Host
{

	public abstract class IntervalComponents : IComponents
	{
		/// <summary>
		/// 间隔秒数
		/// </summary>
		/// <value>The interval second.</value>
		public long IntervalSecond { get; set; }

		/// <summary>
		/// 创建组件时
		/// </summary>
		public override void OnAdd() { }

		/// <summary>
		/// 组件进入时
		/// </summary>
		public override void OnEnter() { }

		/// <summary>
		/// 组件退出时
		/// </summary>
		public override void OnExit() { }

		/// <summary>
		/// 组件移除时
		/// </summary>
		public override void OnRemove() { }

		/// <summary>
		/// 更新
		/// </summary>
		public override void Update()
		{
			LastRunTime = DateTime.Now.Ticks / TICK2SECOND;
			NextRunTime = LastRunTime + IntervalSecond;
		}
	}
}
